home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Include / FWLink.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  4.2 KB  |  143 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWLink.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWLINK_H
  11. #define FWLINK_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef FWRUNTYP_H
  18. #include "FWRunTyp.h"
  19. #endif
  20.  
  21. #ifndef FWTCOLL_H
  22. #include "FWTColl.h"
  23. #endif
  24.  
  25. #ifndef FWODTYPS_H
  26. #include "FWODTyps.h"
  27. #endif
  28.  
  29. #ifndef FWORDCOL_H
  30. #include "FWOrdCol.h"
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward Declarations
  35. //========================================================================================
  36.  
  37. class ODShape;
  38. class ODFacet;
  39.  
  40. class FW_CFacetContext;
  41. class FW_CFrame;
  42. class FW_CMouseEvent;
  43. class FW_CPart;
  44. class FW_CPresentation;
  45. class FW_CGraphicContext;
  46.  
  47. union FW_BitPattern;
  48.  
  49. //=======================================================================================
  50. //    Constants
  51. //=======================================================================================
  52.  
  53. #define FW_kLinkBorderWidth 4
  54.  
  55. extern const FW_BitPattern    FW_kHLinkPat;
  56. extern const FW_BitPattern    FW_kVLinkPat;
  57. extern const FW_BitPattern    FW_kSelectedHLinkPat;
  58. extern const FW_BitPattern    FW_kSelectedVLinkPat;
  59.  
  60. // Current version of persistent links
  61. #define FW_kLinkVersionNumber 1
  62.  
  63. //========================================================================================
  64. //    class FW_CLink
  65. //========================================================================================
  66.  
  67. class FW_CLink
  68. {
  69.   public:
  70.     FW_CLink(Environment* ev, FW_CPresentation* presentation);
  71.     virtual ~ FW_CLink();
  72.  
  73. //----------------------------------------------------------------------------------------
  74. //    API
  75. //
  76.   public:
  77.     virtual ODShape*    DoCreateLinkBorderShape(Environment* ev);
  78.     virtual void        DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc);
  79.  
  80.     void                InvalidateBorder(Environment* ev);
  81.     FW_Boolean            IsMouseInBorder(Environment* ev, FW_CFrame* frame, const FW_CMouseEvent& theMouseEvent);
  82.  
  83.     FW_Boolean            IsBorderShown(Environment* ev) const;
  84.     FW_Boolean            IsLinkSelected(Environment* ev) const;
  85.     void                Select(Environment* ev, FW_Boolean newState);
  86.  
  87.     void                SetSelectState(Environment* ev, FW_Boolean state);
  88.     void                SetShowBorder(Environment* ev, FW_Boolean showBorder);
  89.  
  90.     void                ShowHideLinkBorder(Environment* ev, FW_Boolean turnOn, ODFacet* facet);
  91.  
  92.   private:
  93.     void                PrivDrawLinkBorder(Environment* ev, ODFacet* facet);
  94.  
  95. //----------------------------------------------------------------------------------------
  96. //    Data Members
  97. //
  98.   protected:
  99.     FW_CPresentation*    fPresentation;
  100.  
  101.   private:
  102.     FW_Boolean            fSelected;
  103.     FW_Boolean            fShowBorder;        // Is the link border turned on?
  104. };
  105.  
  106. //========================================================================================
  107. //    FW_CLink Inlines
  108. //========================================================================================
  109.  
  110. //----------------------------------------------------------------------------------------
  111. //    FW_CLink::IsBorderShown
  112. //----------------------------------------------------------------------------------------
  113. inline FW_Boolean FW_CLink::IsBorderShown(Environment*) const
  114. {
  115.     return fShowBorder;
  116. }
  117.  
  118. //----------------------------------------------------------------------------------------
  119. //    FW_CLink::SetShowBorder
  120. //----------------------------------------------------------------------------------------
  121. inline void FW_CLink::SetShowBorder(Environment*, FW_Boolean showBorder)
  122. {
  123.     fShowBorder = showBorder;
  124. }
  125.  
  126. //----------------------------------------------------------------------------------------
  127. //    FW_CLink::IsLinkSelected
  128. //----------------------------------------------------------------------------------------
  129. inline FW_Boolean FW_CLink::IsLinkSelected(Environment*) const
  130. {
  131.     return fSelected;
  132. }
  133.  
  134. //----------------------------------------------------------------------------------------
  135. //    FW_CLink::SetSelectState
  136. //----------------------------------------------------------------------------------------
  137. inline void FW_CLink::SetSelectState(Environment*, FW_Boolean state)
  138. {
  139.     fSelected = state;
  140. }
  141.  
  142. #endif
  143.